//-----------------------------------------------------------------------------
// Name: Bounding.cpp
// Auth: Paul Godfrey & Rob Darty
// Desc: Bounding Boxes
//-----------------------------------------------------------------------------

#include <windows.h>
#include "Display.h"

#include "Assert.h"
#include "DisplayManager.h"
#include "SharedConstants.h"
#include "Systems.h"
//#include "Ground.h"
//#include "Box.h"
//#include "Box2.h"
#include <math.h>
#include "Bounding.h"
#include <list>
#include <iostream>

#include "corona/corona.h"
//Global
//cBounding gBounding[ 2 ];
cBounding gBounding;
//cBounding gBounding;
//list<int> boundingList;

int gPosition = 0;

//Returns Bounding Shape
//cBounding* GetBounding( int i )
//{
//	return &gBounding[ i ];
//}

cBounding* GetBounding()
{
	return &gBounding;
}


//Bounding shape has a center position, radius of half of a box length and a type (s for sphere, b for box)
cBounding::cBounding() :
	mMinX(0.0f),
	mMaxX(0.0f),
	mMinY(0.0f),
	mMaxY(0.0f),
	mMinZ(0.0f),
	mMaxZ(0.0f),
	mIPosition(0),
	mBStatus(true)
{
	setPosition();
}

cBounding::cBounding( float minX, float maxX, float minY, float maxY,
											float minZ, float maxZ )
{
	mMinX = minX;
	mMaxX = maxX;
	mMinY = minY;
	mMaxY = maxY;
	mMinZ = minZ;
	mMaxZ = maxZ;
	mBStatus = true;

	setPosition();
}



//Destructor
cBounding::~cBounding()
{
}

//Create a bounding box with max mins
void cBounding::SetBounding(float xMin, float xMax, float yMin, float yMax, float zMin, float zMax)
{
	mMinX = xMin;
	mMaxX = xMax;
	mMinY = yMin;
	mMaxY = yMax;
	mMinZ = zMin;
	mMaxZ = zMax;
	mType = kBoxCol;

}

//Creates a bounding sphere
void cBounding::SetSphere(float x, float y, float z, float r, enum eCollisionType t )
{
	mXPos = x;
	mYPos = y;
	mZPos = z;
	mRadius = r;
	mType = t;

}

//get minimum bounding x cooridinate
float cBounding::getMinX()
{
	return mMinX;
}

//Get max X
float cBounding::getMaxX()
{
	return mMaxX;
}

//Get Min Y
float cBounding::getMinY()
{
	return mMinY;
}

//Get MaxY
float cBounding::getMaxY()
{
	return mMaxY;
}

//Get MinZ
float cBounding::getMinZ()
{
	return mMinZ;
}

//Get Max Z
float cBounding::getMaxZ()
{
	return mMaxZ;
}

//Gets position
int cBounding::getPosition()
{
	return mIPosition;
}

//Sets position
void cBounding::setPosition()
{
	++gPosition;

	mIPosition = gPosition;

	return;
}

//Get status
bool cBounding::getStatus()
{
	
	return mBStatus;
}

//Get sphere radius
float cBounding::GetSphereRadius()
{
	return mRadius;
}

//Get sphere X
float cBounding::GetSphereX()
{
	return mXPos;
}

//Get Sphere Y
float cBounding::GetSphereY()
{
	return mYPos;
}

//Get SphereZ
float cBounding::GetSphereZ()
{
	return mZPos;
}

//Gets bounding type
enum eCollisionType cBounding::GetType()
{
	return mType;
}


